package routers

import (
	"fmt"
	"net/http"

	"gitverse.ru/tokuara/impleo/restapi/handlers"
)

func InitRouter() *http.ServeMux {
	router := http.NewServeMux()

	router.HandleFunc("/api", func(w http.ResponseWriter, r *http.Request) {
		fmt.Fprintf(w, "Hello, you've requested: %s\n", r.URL.Path)
	})

	router.HandleFunc("/api/auth/signin", handlers.SignIn)
	router.HandleFunc("/api/auth/signup", handlers.SignUp)
	router.HandleFunc("/api/auth/forgot", handlers.Auth)

	router.HandleFunc("/api/users", handlers.GetUsers)
	router.HandleFunc("/api/user/{id}", handlers.GetUserById)

	router.HandleFunc("/api/events", handlers.GetEvents)
	router.HandleFunc("/api/event/{id}", handlers.GetEventById)

	router.HandleFunc("/api/articles", handlers.GetArticles)
	router.HandleFunc("/api/article/{id}", handlers.GetEventById)

	router.HandleFunc("/api/blogs", handlers.GetBlogs)
	router.HandleFunc("/api/blog/{id}", handlers.GetBlogById)

	return router
}
